<?php
class CmsTagModel extends Model
{
    protected $resourceId = 'AdminResource';
    protected static $instance;

    public static function GetInstance()
    {
        return self::$instance ? self::$instance : self::$instance = new CmsTagModel();
    }

    public function Search($query)
    {
        $cond = new SqlQuery("id LIKE '@query%'");
        $cond->AddStringNoquote('query', $query);
        return $this->ListField('id', $cond);
    }

    public function Add($tag)
    {
        $item['id'] = $tag;
        return $this->Insert($item);
    }
}
?>
